package cn.iocoder.yudao.module.system.enums.investment;

import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

@Getter
@AllArgsConstructor
public enum InvestmentStatusEnum implements IntArrayValuable {
    NOT_STARTED(0, "未开始"),
    IN_PROGRESS(1, "进行中"),
    ENDED(2, "已结束");

    public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(InvestmentStatusEnum::getStatus).toArray();

    private final Integer status;
    private final String name;

    @Override
    public int[] array() {
        return ARRAYS;
    }

    public static String getNameByStatus(Integer status) {
        return Arrays.stream(values()).filter(item -> item.getStatus().equals(status)).findFirst().map(InvestmentStatusEnum::getName).orElse("");
    }
}
